﻿<?php
if (!defined('WEB_ROOT')) {
	exit;
}

if (isset($_GET['mannc']) && $_GET['mannc'] !='') {
	$mannc = $_GET['mannc'];
	$queryString = "&mannc=$mannc";
} else {
	$mannc = '';
	$queryString = '';
}
	
// for paging
// how many rows to show per page
$rowsPerPage = 5;

$sql = "SELECT mannc, tennnc, matg, ngaythanhlap, madv
        FROM nhomnc
		
		ORDER BY tennnc";
$result     = dbQuery(getPagingQuery($sql, $rowsPerPage));
$pagingLink = getPagingLink($sql, $rowsPerPage);
?>
<p>&nbsp;</p>
<form action="processGroup.php?action=addGroup" method="post"  name="frmListGroup" id="frmListGroup">
 <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="text">
  <tr align="center" id="listTableHeader"> 
   <td>Tên nhóm nghiên cứu</td>
   <td>Ngày thành lập</td>
   <td width="75">Ðơn vị</td>
   <td width="75">Sửa</td>
   <td width="75">Xóa</td>
  </tr>
  <?php
	//$cat_parent_id = 0;
if (dbNumRows($result) > 0) {
	$i = 0;
	while($row = dbFetchAssoc($result)) {
		extract($row);
		
		if ($i%2) {
			$class = 'row1';
		} else {
			$class = 'row2';
		}
		
		$i += 1;
		
		
		/*if ($cat_parent_id == 0) {
			$cat_name = "<a href=\"index.php?catId=$cat_id\">$cat_name</a>";
		}
		
		if ($cat_image) {
			$cat_image = WEB_ROOT . 'images/category/' . $cat_image;
		} else {
			$cat_image = WEB_ROOT . 'images/no-image-small.png';
		}		*/
	
?>
  <tr class="<?php echo $class; ?>"> 
   <td><?php echo $tennnc; ?></td>
   <td><?php echo nl2br($ngaythanhlap); ?></td>
	<td><?php echo nl2br($madv); ?></td>
   <td width="75" align="center"><a href="javascript:modifyGroup(<?php echo $mannc; ?>);">Sửa</a></td>
   <td width="75" align="center"><a href="javascript:deleteGroup(<?php echo $mannc; ?>);">Xóa</a></td>
  </tr>
  <?php
	} // end while


?>
  <tr> 
   <td colspan="5" align="center">
   <?php 
   echo $pagingLink;
   ?></td>
  </tr>
<?php	
} 
else {
?>
  <tr> 
   <td colspan="5" align="center">Không có nhóm nghiên cứu nào</td>
  </tr>
  <?php
}
?>
  <tr> 
   <td colspan="5">&nbsp;</td>
  </tr>
  <tr> 
   <td colspan="5" align="right"> <input name="btnAddGroup" type="button" id="btnAddGroup" value="Thêm nhóm nghiên cứu" class="box" onClick="addGroup()"> 
   </td>
  </tr>
 </table>
 <p>&nbsp;</p>
</form>
